import React from 'react';

// 路由项生成函数
const getRoutesItem = (
  path: string,
  component: React.ComponentType<any>,
  desc: string,
  exact = true,
) => {
  return {
    path,
    component,
    exact,
    desc,
  };
};

// 路由配置
const routesConfig = [
  getRoutesItem(
    '/',
    React.lazy(() => import('../pages/chat/index')), // 动态引入,注意用了lazy之后要用suspend组件包起来,两者降级处理，https://react.caoweiju.com/src/advance/others.html
    '首页',
  ),
  getRoutesItem(
    '/user',
    React.lazy(() => import('../pages/user/index')),
    '用户',
  ),
];

export default routesConfig;
